<include file="__THEME__/header" />
<link rel="stylesheet" href="../Public/gift.css" type="text/css" charset="utf-8" />
<script src="../Public/js/gift.js" type="text/javascript"></script>
<script type="text/javascript">
var url = '__URL__';
$(function(){
		selectItems(1);
		<php>if($_GET["uid"] && $_GET['uid'] != $mid){</php>
			//指定发给某人
			var uid = {.uid}?{.uid}:"";
			if(uid){
				$(".ui-fs-input").remove();
				var image = "{$toUserFace}";
				var name  = "{$toUserName}";
				$(".ui-fs-result").append("<a href='javascript:void(0)' ><img width='20' height='20' src='" + image + "' title='" + name + "' alt='' />" + name + "</a>");
	            $("#ui_fri_ids").val(uid);
			}   
	<php>}</php>
});
function selectItems(id){
	$('.gift_items').each(function(test){
		$(this).attr('class','gift_items');
	});
	$('.giftblock').each(function(){
		$(this).css('display','none');
	});
	$('#gifts'+id).css('display','block');
	$('#item'+id).attr('class','gift_items on');
}

function sendGift(id){
	var clickid = 'gift'+id;
	$('.gifts').each(function(){
		if($(this).attr('id')==clickid){
			$(this).attr('class','gifts hand on');
		}else{
			$(this).attr('class','gifts hand');
		}
	});
	var temp_gift = $('#gift'+id).clone();
	$('#gift_info').html('');
	$('#gift_info').append(temp_gift.html());
	$('#gift_id').val(id);

	scroller('sendto', 1000);
}
function check(){
	if(!$('#gift_id').val()){
		Alert('请选择礼物');
		return false;
	}
	if(!($('#ui_fri_ids').val())){
		Alert('请选择礼物发送对象');
		return false;
	}
}
</script>

<div class="content">
  <!-- 内容 begin  -->
  <include file="__THEME__/apps" />
  <div class="main"><!-- 画布 begin  -->
    <div class="page_title">
      <h2><img src="../Public/images/ico_apply.gif" />礼品</h2>
      <div class="c"></div>
    </div>
    <div class="tab-menu">
      <!-- 切换标签 begin  -->
      <ul>
        <li><a class="on" href="__URL__/index"><span>礼物中心</span></a></li>
        <li><a href="__URL__/receivebox"><span>收到的礼物</span></a></li>
        <li><a href="__URL__/sendbox"><span>送出的礼物</span></a></li>
      </ul>
    </div> <!-- 切换标签 end  -->
    <div style="padding-left:20px;">
    <div class="f14px fB lh35" style=" margin-top:30px;">选择一个礼物:</div>
     <div class="tab_lw">
	    <volist name = 'categorys' id = 'category' key='k'>
	       	<a href="javascript:void(0)" class="gift_items on" onclick='selectItems({$category['id']})' id='item{$category['id']}' >{$category['name']}</a>
	    </volist>
    </div>
    	<volist name = 'categorys' id = 'category'>
    	<div class="giftblock" id='gifts{$category['id']}' style="display:none;" >
    		<ul>
    			<volist name = "category['gifts']" id='gift'>
	        	<li class='gifts hand' title="点击选择" id="gift{$gift['id']}" onclick="sendGift({$gift['id']})">
	        		<img src="../Public/gift/{$gift['img']}" /><br />
	        		{$gift['name']}<br />
	        		限量：{$gift['num']}个<br />
	        		{$gift['price']}个{$config.creditName}				
	        	</li>
	        	</volist>
	            <div class="c"></div>
        	</ul>
    	</div>
    </volist>
	<a name="sendto" id="sendto"></a>
    <div id='gift_info'></div>
    <form action="__URL__/send/" method='post' onsubmit='return check()'>
    <div style="margin-top:20px;">
        <h2 class="f14px fB lh30">我目前拥有的{$config.creditName}是： {$money}</h2>       
    </div>	
    <div style="margin-top:30px;">
    <h2 class="f14px fB lh30">选择接收人：</h2>
          <div style="width:360px;">{:W("SelectFriend")}</div>
    <div style="margin-top:20px;">
        <h2 class="f14px fB lh30">附加消息：</h2>
        <p style="margin:0; padding:0;">不能超过200个字符</p>
        <textarea cols="50" rows="6" class="Text20" name='sendInfo'></textarea>
    </div>
    <div>
    	<div class="lh30 fB f14px">选择赠送的方式：</div>
        <div>
        <div class="left">
        <input checked="checked" value="1" id="public" name="sendWay" type="radio" /></div>
<div style="margin:0 0 20px 20px;" class="lh18"><label for="public"><strong>公开赠送</strong><br />
<span class="cGray2">其他人可以看见你的礼物和消息。<br />
这个礼物将显示在接受人的礼物盒和新鲜事里。</span></label></div>
<div class="left"><input value="2" id="private" name="sendWay" type="radio"/></div>
<div style="margin-left:20px;" class="lh18"><label for="private"> <strong>私下赠送</strong><br />
<span class="cGray2">其他人只能看见礼物，只有接收礼物的人能看见你的名字和消息<br />
这个礼物将只出现在接收人的礼物盒里。</span></label></div>
<br />
<div class="left"><input value="3" id="anonymous" name="sendWay" type="radio" /></div>
<div style="margin:0 0 20px 20px;" class="lh18">
<label for="anonymous" > <strong>匿名赠送</strong><br />
<span class="cGray2">其他人只能看见礼物，只有接收礼物的人能看见你的消息，但不显示你的名字。<br />
这个礼物将显示在接收人的礼物盒里。</span></label></div>
	<input type='hidden' name='giftId' value='' id='gift_id'></input>
</div>
    </div>
    <div class="mt10"><input type="submit" class="btn_b" style="margin-right:5px;" value="赠送礼物" /><input type="button" class="btn_w" value="取消" /></div>
    </div>
    </form>
    </div>
  </div><!-- 画布 end  -->
  <div class="c"></div>
</div><!-- 内容 end -->
<include file="__THEME__/footer" /> 